package com.coca1cole.subject.common.enums;

import lombok.Getter;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 题目类型枚举
 * 1单选 2多选 3判断 4简答
 */
@Getter
public enum SubjectInfoTypeEnum {

    RADIO(1, "单选"),
    MULTIPLE(2, "多选"),
    JUDGE(3, "判断"),
    BRIEF(4, "简答"),
    ;

    public int code;

    public String desc;

    public static final Map<Integer, SubjectInfoTypeEnum> subjectTypeMap =
            Stream.of(SubjectInfoTypeEnum.values())
                    .collect(Collectors.toMap(e -> e.getCode(), e -> e));

    SubjectInfoTypeEnum(
            int code, String
            desc) {
        this.code = code;
        this.desc = desc;
    }

    public static SubjectInfoTypeEnum getByCode(int codeVal) {
        return subjectTypeMap.get(codeVal);
    }

}
